package com.tsd.system.service;

import com.tsd.core.vo.PageBean;
import com.tsd.system.entity.SysResourceExt;
import com.tsd.system.entity.SysUser;
import com.tsd.system.entity.SysUserResource;
import com.tsd.system.entity.SysUserResourceExt;

import java.util.List;
import java.util.Map;


/**
 * 描述：SysUserResource服务实现层接口
 *
 * @author Hillpool
 * @date 2019/03/12 12:20:51
 */
public interface SysUserResourceService {

    /**
     * 描述：根据id获取SysUserResource
     *
     * @param id
     */
    SysUserResource getSysUserResourceById(Long id) throws Exception;

    /**
     * 描述：保存或更新SysUserResource
     *
     * @param record
     */
    void saveSysUserResource(SysUserResource record) throws Exception;

    /**
     * 描述：根据id删除SysUserResource
     *
     * @param id
     */
    void deleteSysUserResource(Long id) throws Exception;

    /**
     * 描述：根据userId删除SysUserResource
     *
     * @param params
     */

    /**
     * 描述：根据params分页查询SysUserResource
     *
     * @param params
     * @param page
     */
    List<SysUserResourceExt> findSysUserResources(Map<String, Object> params, PageBean page) throws Exception;

    void updateFromInheritedByUserRole() throws Exception;

    void deleteSysUserResource(SysUser sysUser, String userId, List<String> resourceIdList) throws Exception;

    /**
     * 删除某个用户的资源
     *
     * @param sysUser
     * @param userId
     * @throws Exception
     */
    void deleteSysUserResource(SysUser sysUser, String userId) throws Exception;

    List<SysResourceExt> queryTree4UserId(String parentCode, String userId) throws Exception;

    void saveSysResourceList2User(SysUser opUser, String userId, List<String> resourceIdList) throws Exception;

    List<SysUserResourceExt> findSysUserResourceByUserSid(String userSid);

    List<SysResourceExt> queryTree4UserIdNew(String parentCode, String userId) throws Exception;

    /**
     * 根据parentCode，userId查询角色下的资源
     *
     * @param parentCode
     * @param userId
     * @return
     * @throws Exception
     */
    List<SysResourceExt> queryTree4UserIdRole(List<String> parentCode, String userId) throws Exception;
}
